Lexical Analysis
Q1.
Consider the following statements. I. Symbol table is accessed only during lexical analysis and syntax analysis. II. Compilers for programming languages that support recursion necessarily need heap storage for memory allocation in the run-time environment. III. Errors violating the condition 'any variable must be declared before its use' are detected during syntax analysis. Which of the above statements is/are TRUE?Q2.
A symbol table of length 152 is processing 25 entries at any instant. What is occupation density?Q3.
The lexical analysis for a modern computer language such as Java needs the power of which one of the following machine models in a necessary and sufficient sense?Q4.
Number of comparisons required for an unsuccessful search of an element in a sequential search organized, fixed length, symbol table of length L isQ6.
A particular BNF definition for a "word is given by the following rules. < word > :: =< letter > I < letter > < charpair > I < letter >< intpair > < charpair > :: =< letter >< letter > I < charpair >< letter >< letter > < intpair > :: = < integer >< integer > I < intpair >< integer >< integer > < letter > :: = a I b I c I ......I Y I Z < integer > :: = 0 I 1 I 2 I ......I 9 Which of the following lexical entries can be derived from < word >? I. pick II. picks III. c44Q8.
The number of tokens in the following C code segment is switch(inputvalue) { case 1 : b =c*d; break; default : b =b++; break; }Q9.
A lexical analyzer uses the following patterns to recognize three tokens T_{1}, T_{2}, \; and \; T_{3} over the alphabet {a,b,c}. T_{1}:a?(b|c)^* a T_{2}:b?(a|c)^* b T_{3}:c?(b|a)^* c Note that 'x?' means 0 or 1 occurrence of the symbol x. Note also that the analyzer outputs the token that matches the longest possible prefix. If the string bbaacabc is processed by the analyzer, which one of the following is the sequence of tokens it outputs?Q10.
The number of tokens in the following C statement is printf("i=%d, &i=%x", i, &i);